package net.lab1024.sa.admin.module.business.tz.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.extra.servlet.ServletUtil;
import net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeDetailVO;
import net.lab1024.sa.admin.module.business.tz.domain.form.TzAddForm;
import net.lab1024.sa.admin.module.business.tz.domain.form.TzQueryForm;
import net.lab1024.sa.admin.module.business.tz.domain.form.TzUpdateForm;
import net.lab1024.sa.admin.module.business.tz.domain.vo.TzVO;
import net.lab1024.sa.admin.module.business.tz.service.TzService;
import net.lab1024.sa.admin.module.system.type.domain.TypeEntity;
import net.lab1024.sa.admin.module.system.type.service.TypeService;
import net.lab1024.sa.base.common.domain.ValidateList;
import net.lab1024.sa.base.common.util.SmartRequestUtil;
import org.springframework.web.bind.annotation.*;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * 通知 Controller
 *
 * @Author syf
 * @Date 2025-06-03 17:53:30
 * @Copyright 畅想科技
 */

@RestController
@Tag(name = "")
public class TzController {

    @Resource
    private TzService tzService;
    @Resource
    private TypeService typeService;
    @Operation(summary = "分页查询 @author syf")
    @PostMapping("/tz/queryPage")
    public ResponseDTO<PageResult<TzVO>> queryPage(@RequestBody @Valid TzQueryForm queryForm) {
        return ResponseDTO.ok(tzService.queryPage(queryForm));
    }
    @Operation(summary = "查询 @author syf ")
    @GetMapping("/tz/view/{noticeId}")
    public ResponseDTO<TzVO> view(@PathVariable Long noticeId) {
        return tzService.view(noticeId);
    }
    @Operation(summary = "添加 @author syf")
    @PostMapping("/tz/add")
    public ResponseDTO<String> add(@RequestBody @Valid TzAddForm addForm) {
        return tzService.add(addForm);
    }
    @Operation(summary = "获取订单状态列表")
    @PostMapping("/tz/queryType")
    public ResponseDTO<List<TypeEntity>> queryShopPage(@RequestParam(defaultValue = "notice_obj") String key) {
        return typeService.getTypeList(key);
    }
    @Operation(summary = "更新 @author syf")
    @PostMapping("/tz/update")
    public ResponseDTO<String> update(@RequestBody @Valid TzUpdateForm updateForm) {
        return tzService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author syf")
    @PostMapping("/tz/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Integer> idList) {
        return tzService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author syf")
    @GetMapping("/tz/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Integer id) {
        return tzService.delete(id);
    }
}
